cssnode: Change the way we invalidate timestamps
authorBenjamin Otte <otte@redhat.com>
Sat, 28 Feb 2015 01:22:38 +0000 (02:22 +0100)
committerBenjamin Otte <otte@redhat.com>
Wed, 18 Mar 2015 14:23:33 +0000 (15:23 +0100)
Do not propagate the TIMESTAMP change through the node tree, as that
causes lots of uneeded markings of nodes as invalid.

Instead, walk the node tree and find the nodes that have a non-static
style and only invalidate timestamps on those.

gtk/gtkcssnode.c

index 297068b4862aa194d07ebf2904994ac092a10bfe..547cfb91c9a31fcec2a4aea9e6e071edde4b0437 100644 (file)
@@ -841,6 +841,23 @@ gtk_css_node_invalidate_style_provider (GtkCssNode *cssnode)
     }
 }
 
+static void
+gtk_css_node_invalidate_timestamp (GtkCssNode *cssnode)
+{
+  GtkCssNode *child;
+
+  if (!cssnode->invalid)
+    return;
+
+  if (!gtk_css_style_is_static (cssnode->style))
+    gtk_css_node_invalidate (cssnode, GTK_CSS_CHANGE_TIMESTAMP);
+
+  for (child = cssnode->first_child; child; child = child->next_sibling)
+    {
+      gtk_css_node_invalidate_timestamp (child);
+    }
+}
+
 void
 gtk_css_node_invalidate_frame_clock (GtkCssNode *cssnode,
                                      gboolean    just_timestamp)
@@ -849,10 +866,10 @@ gtk_css_node_invalidate_frame_clock (GtkCssNode *cssnode,
   if (cssnode->parent)
     return;
 
-  if (just_timestamp)
-    gtk_css_node_invalidate (cssnode, GTK_CSS_CHANGE_TIMESTAMP);
-  else
-    gtk_css_node_invalidate (cssnode, GTK_CSS_CHANGE_TIMESTAMP | GTK_CSS_CHANGE_ANIMATIONS);
+  gtk_css_node_invalidate_timestamp (cssnode);
+
+  if (!just_timestamp)
+    gtk_css_node_invalidate (cssnode, GTK_CSS_CHANGE_ANIMATIONS);
 }
 
 void